import javax.swing.*;

import java.awt.*;
import java.awt.event.*;

public class Errorea extends Frame{
	Frame nireFrame;
	Integer zenb;
	String izena;
	String pasahitza;
	public Errorea(Frame parent, Boolean modal, Integer z, String i, String p) {
		nireFrame = parent;
		zenb = z;
		izena = i;
		pasahitza = p;
		enableEvents(AWTEvent.WINDOW_EVENT_MASK);
		try {
			jbInit();
		}
		catch (Exception e) {
			e.printStackTrace();
		}
	}
	private void jbInit() throws Exception {
		final JFrame f = new JFrame();
		Container container = f.getContentPane();
		container.setLayout(null);
		((JPanel)container).setBorder(BorderFactory.createTitledBorder("Errorea"));
		if (zenb == 1) {
			JLabel gaizki = new JLabel("Izena edo pasahitza gaizki sartu da");
			gaizki.setBounds(45, 50, 200, 25);
			f.add(gaizki);
			JButton atzera1 = new JButton("Atzera");
			atzera1.setBounds(90, 90, 100, 25);
			f.add(atzera1);
			f.setSize(300,200);
			f.setTitle("Euskaltoy");
			f.setVisible(true);
			f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
			atzera1.addActionListener(new java.awt.event.ActionListener() {
				public void actionPerformed(ActionEvent e) {
					atzera1_actionPerformed(e);
					f.setVisible(false);
				}
			});
		}
		if (zenb == 2) {
			JLabel gaizki = new JLabel("Erregistroa gaizki joan da");
			gaizki.setBounds(70, 50, 150, 25);
			f.add(gaizki);
			JButton atzera2 = new JButton("Atzera");
			atzera2.setBounds(90, 90, 100, 25);
			f.add(atzera2);
			f.setSize(300,200);
			f.setTitle("Euskaltoy");
			f.setVisible(true);
			f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
			atzera2.addActionListener(new java.awt.event.ActionListener() {
				public void actionPerformed(ActionEvent e) {
					atzera2_actionPerformed(e);
					f.setVisible(false);
				}
			});
		}
		if (zenb == 3) {
			JLabel gaizki = new JLabel("Aldaketak ezin izan dira burutu");
			gaizki.setBounds(55, 50, 200, 25);
			f.add(gaizki);
			JButton atzera3 = new JButton("Atzera");
			atzera3.setBounds(90, 90, 100, 25);
			f.add(atzera3);
			f.setSize(300,200);
			f.setTitle("Euskaltoy");
			f.setVisible(true);
			f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
			atzera3.addActionListener(new java.awt.event.ActionListener() {
				public void actionPerformed(ActionEvent e) {
					atzera3_actionPerformed(e);
					f.setVisible(false);
				}
			});
		}
		if (zenb == 4) {
			JLabel gaizki = new JLabel("Ez da produkturik aukeratu");
			gaizki.setBounds(60, 50, 170, 25);
			f.add(gaizki);
			JButton atzera4 = new JButton("Atzera");
			atzera4.setBounds(90, 90, 100, 25);
			f.add(atzera4);
			f.setSize(300,200);
			f.setTitle("Euskaltoy");
			f.setVisible(true);
			f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
			atzera4.addActionListener(new java.awt.event.ActionListener() {
				public void actionPerformed(ActionEvent e) {
					atzera4_actionPerformed(e);
					f.setVisible(false);
				}
			});
		}
		if (zenb == 5) {
			JLabel gaizki = new JLabel("Produkturen batean ez da kantitaterik aukeratu");
			gaizki.setBounds(10, 50, 270, 25);
			f.add(gaizki);
			JButton atzera5 = new JButton("Atzera");
			atzera5.setBounds(90, 90, 100, 25);
			f.add(atzera5);
			f.setSize(300,200);
			f.setTitle("Euskaltoy");
			f.setVisible(true);
			f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
			atzera5.addActionListener(new java.awt.event.ActionListener() {
				public void actionPerformed(ActionEvent e) {
					atzera5_actionPerformed(e);
					f.setVisible(false);
				}
			});
		}
		if (zenb == 6) {
			JLabel gaizki = new JLabel("Eskera ezin izan da burutu");
			gaizki.setBounds(70, 50, 150, 25);
			f.add(gaizki);
			JButton atzera6 = new JButton("Atzera");
			atzera6.setBounds(90, 90, 100, 25);
			f.add(atzera6);
			f.setSize(300,200);
			f.setTitle("Euskaltoy");
			f.setVisible(true);
			f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
			atzera6.addActionListener(new java.awt.event.ActionListener() {
				public void actionPerformed(ActionEvent e) {
					atzera6_actionPerformed(e);
					f.setVisible(false);
				}
			});
		}
	}
	void atzera1_actionPerformed(ActionEvent e) {
		new Frame1();
	}
	void atzera2_actionPerformed(ActionEvent e) {
		new Erregistratu(this, true);
	}
	void atzera3_actionPerformed(ActionEvent e) {
		new DatuakAldatu(this, true);
	}
	void atzera4_actionPerformed(ActionEvent e) {
		new ProduktuakKautotuta(this, true, izena, pasahitza);
	}
	void atzera5_actionPerformed(ActionEvent e) {
		new ProduktuakKautotuta(this, true, izena, pasahitza);
	}
	void atzera6_actionPerformed(ActionEvent e) {
		new Frame1();
	}
}